package com.example.configdemo.demos.web.controller;

import com.example.configdemo.demos.web.model.Student;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.PostConstruct;

/**
 * @author Q
 * @create 2025-05-30-18:53
 */
@RestController
public class YmlController {
    @Value("${key}")
    private String key;
    @Value("${server.port}")
    private Integer serverPort;

    @Value("${server.reactive.session.cookie.domain}")
    private String cookieDomain;
    //配置字符串测试
    @Value("${string.str1}")
    private String str1;
    @Value("${string.str2}")
    private String str2;
    @Value("${string.str3}")
    private String str3;
    //配置对象测试
    @Autowired//获取Spring管理的数据
    private Student student;
    @PostConstruct
    public void readValue() {
//        System.out.println(key);
//        System.out.println(serverPort);
//        System.out.println(cookieDomain);
//
//        System.out.println(str1);
//        System.out.println(str2);
//        System.out.println(str3);
        //配置对象测试,集合,map
        System.out.println(student);

    }
}
